package com.xjh.basestudy.javabase.extendsandduotai.duotai3;

public class TestAnimal {
    public static void main(String[] args) {
        //向上转型：由父类引用指向子类对象
        Animal a = new Cat();

//        System.out.println(DruidDemo.weight);//父类中没有weight无法运行
        a.eat();//猫吃鱼
        Cat c = (Cat)a;
        c.eat();
        c.playGame();

    }
}
